"""website URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from oauth.views import oauth 
from oauth.views import personal
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic.base import TemplateView


# from rest_framework_jwt.views import obtain_jwt_token
from rest_framework_jwt.views import refresh_jwt_token

urlpatterns = [
    path(r'', TemplateView.as_view(template_name='index.html')),
    path('admin/', admin.site.urls),

    path('refresh', refresh_jwt_token), # 刷新token
    path('api/oauth/login/', oauth.UserLoginView.as_view()), # 账号登录
    path('api/oauth/userinfo/', oauth.UserInfoView.as_view()), #  获取用户信息
    path('api/oauth/logout/', oauth.LogoutAPIView.as_view()), # 账号登出

    path('api/information/change-password/', personal.ChangePasswordAPIView.as_view()),  # 修改个人密码
    path('api/information/change-information/', personal.ChangeInformationAPIView.as_view()),  # 修改个人信息
    path('api/information/change-avatar/', personal.ChangeAvatarAPIView.as_view()),  # 修改个人头像
     
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


##### 设置后台名称 ##### 
admin.site.site_header = 'LDAP自助平台'
admin.site.site_title = 'LDAP自助'
